package com.softfly.flink;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.sink.OutputFormatSinkFunction;
import org.apache.flink.streaming.api.windowing.assigners.TumblingEventTimeWindows;
import org.apache.flink.types.Row;


public class HalloFlink {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        env.setParallelism(3);

        DataStream<Row> ds = env.createInput(new RandomInputFormat());
        ds = ds.rebalance();

        ds.addSink(new OutputFormatSinkFunction(new RandomOutputFormat())).name("printSink");


//        ds.keyBy(0);
//        ds.keyBy(0);
//
//        ds.addSink(new OutputFormatSinkFunction(new RandomOutputFormat())).name("printSink");
//        ds.addSink(new OutputFormatSinkFunction(new RandomOutputFormat())).name("bitch");
//        ds.addSink(new OutputFormatSinkFunction(new RandomOutputFormat()));

//        env.createInput(new RandomInputFormat()).addSink(new OutputFormatSinkFunction(new RandomOutputFormat()));
        env.execute();
    }
}
